home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 July
/
1986-07.d64
/
budget planner
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
6KB
|
223 lines
1 print"[147]"
100 dev=8:goto1850
110 printhm$;left$(x$,x);left$(y$,y);:return
120 a=abs(x)+.005-.5*(dp=0):a1=int(a):a$=mid$(str$(a1),2):ifx<0thena$="-"+a$
130 ifdpthen a2$=mid$(str$(int((a-a1)*100)),2):iflen(a2$)<2thena2$="0"+a2$
140 ifdpthena$=a$+"."+a2$
150 a$=right$(sp$+a$,f):return
160 a$=left$(sp$,(x-len(a$))/2)+a$:return
170 fori=1tonw:a=0:forj=0tonr-1:a=a+tb(j,i):next:tb(nr,i)=a:tb(0,i+1)=a:next
180 fori=1tonw:mm=0:iftb(nr,i)<0thenmm=-1:i=nw
190 next:return
200 a$=right$(sp$+"week"+str$(cw),f-2):x=2:y=3:gosub110:print a$;:return
210 a$="budget planner"+str$(yr):x=40:gosub160
220 printcl$;fg$;a$:printd$:printea$:ea$=""
230 gosub280:fori=0tonr:ifmmandi=nrthenprintdebt$;
240 printhm$;left$(y$,i+5);:a$=tb$(i):gosub150:printa$;fg$;
250 forj=wtow+2:ifi=nrandtb(i,j)<0thenprintdebt$;
260 x=tb(i,j):gosub120:printa$;fg$;
270 next:next:return
280 gosub200:a=d:b=m:c=yr
290 forz=1to3
300 a$=str$(d)+mnth$(m):gosub150:printa$;
310 gosub580:next
320 d=a:m=b:yr=c
330 print"[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
340 return
350 gosub200:x=tb(cr,cw):gosub120:b$=rv$+a$+nv$:x=cc*10:y=cr+5:gosub110
360 printb$;
370 getc$:ifc$=""then370
380 ifc$="+"orc$="-"orc$="."or(c$>="0"andc$<="9")then740
390 ifc$=up$then610
400 ifc$=dn$then640
410 ifc$=lf$then660
420 ifc$=rt$then700
430 ifc$=cr$thenreturn
440 ifc$=bk$theniflen(d$)<>0thenc$="":d$=left$(d$,len(d$)-1):goto740
450 gosub110:printa$;
460 ifasc(c$)>132andasc(c$)<141then760
470 ifc$="[205]"then1650
480 ifc$="[196]"thendp=notdp:gosub210:goto350
490 ifc$="[197]"then1730
500 ifc$="[198]"then1790
510 ifc$="[215]"then1630
520 ifc$="[212]"thendev=1:ea$="tape selected[146]":gosub210:goto350
530 ifc$="[209]"thendev=8:ea$="disk selected[146]":gosub210:goto350
540 gosub110:printb$:goto370
550 d=d-7:ifd>=1thenreturn
560 m=m-1:ifm>=1thend=d+mnth(m):return
570 yr=yr-1:m=12:d=d+mnth(m):return
580 d=d+7:ifd<=mnth(m)thenreturn
590 d=d-mnth(m):m=m+1:ifm<13thenreturn
600 yr=yr+1:m=1:return
610 ifcr=0then370
620 cr=cr-1
630 gosub110:printa$;:goto350
640 ifcr<>nr-1thencr=cr+1:goto630
650 goto370
660 ifcc<>1thencc=cc-1:cw=cw-1:goto630
670 ifcw=1then370
680 cw=cw-1:w=w-1:gosub550
690 gosub210:goto350
700 ifcc<>3thencc=cc+1:cw=cw+1:goto630
710 ifcw=nwthen370
720 cw=cw+1:w=w+1:gosub580
730 gosub210:goto350
740 iflen(d$)<10thend$=d$+c$:printhm$;dn$;d$;left$(sp$,10-len(d$)):goto370
750 goto370
760 print hm$;dn$;sp$:printsp$
770 onasc(c$)-132gosub780,870,980,1090,1100,1250,1330,1400:goto350
780 x=0:y=0:gosub110:printwh$;"<f1>help <f2>goto <e>nd of month "
790 y=y+1:gosub110:printwh$;"<f3>load[160][160] <f4>save <f>ind neg "
800 y=y+1:gosub110:printwh$;"<f5>+row[160][160] <f6>-row <m>onthly exp "
810 y=y+1:gosub110:printwh$;"<f7>calc[160][160] <f8>prnt <w>eekly exp "
820 y=y+1:gosub110:printwh$;"<q>disk <t>ape <d>ecimal "
830 y=y+1:gosub110:print"<press any key> "
840 geta$:ifa$=""then840
850 printfg$;
860 gosub210:return
870 x=0:y=0:gosub110:printwh$;"*load*[146]"
880 y=y+1:gosub110:f$="":input"filename";f$:iff$=""then1210
890 ifde=8then910
900 open2,1,0,f$:goto920
910 open15,8,15:open2,8,2,f$+",s,r":gosub2300:ifeathengosub210:goto970
920 printcl$;dn$;"loading ";f$
930 input#2,nr,nw,d,m,yr:m0=m:d0=d:y0=yr:cc=1:cr=1:cw=1:w=1:gosub2140
940 ifde=8thengosub2300:ifeathen970
950 fori=0tonr:input#2,tb$(i):forj=0tonw:input#2,tb(i,j):nextj,i
960 gosub170:gosub210
970 close2:close15:return
980 x=0:y=0:gosub110:printwh$;"*+row*[146]"
990 ifnr=18theny=y+1:gosub110:print"-no more room-":goto830
1000 n$="":y=y+1:gosub110:input"name";n$
1010 ifn$=""then1080
1020 y=y+1:gosub110:i$="e":input"(i/e)";i$
1030 a=-1:ifi$="i"thena=1
1040 cr=cr+1
1050 fori=nrtocrstep-1:tb$(i+1)=tb$(i):forj=0tonw:tb(i+1,j)=tb(i,j):nextj,i
1060 fori=1tonw:tb(cr,i)=0:next:tb$(cr)=left$(n$,10)
1070 nr=nr+1:tb(cr,0)=a
1080 gosub210:return
1090 gosub110:printa$;:gosub170:gosub210:return
1100 x=0:y=0:gosub110:printwh$;"*goto*[146]"
1110 y=y+1:gosub110:w$="":input"week";w$
1120 a=int(val(w$))
1130 ifleft$(w$,1)="-"orleft$(w$,1)="+"thena=cw+a
1140 ifa=wthen1200
1150 ifa>50thena=50
1160 ifa<=0then1210
1170 ifa>wthen1220
1180 w=w-1:gosub550
1190 ifa<wthen1180
1200 cw=w:cc=1
1210 gosub210:return
1220 w=w+1:gosub580
1230 ifa>wthen1220
1240 goto1200
1250 x=0:y=0:gosub110:printwh$;"*save*[146]"
1260 y=y+1:gosub110:f$="":input"filename";f$:iff$=""then1210
1270 ifde=8then1290
1280 open2,1,2,f$:goto1300
1290 open15,8,15:open2,8,2,"@0:"+f$+",s,w":gosub2300:ifeathen1320
1300 print#2,nr;",";nw;",";d0;",";m0;",";y0
1310 fori=0tonr:print#2,tb$(i):forj=0tonw:print#2,tb(i,j):nextj,i
1320 close15:close2:gosub170:gosub210:return
1330 x=0:y=0:gosub110:printwh$;"*-row*[146]"
1340 ifcr=0theny=y+1:gosub110:print"illegal row":goto830
1350 y=y+1:gosub110:n$="":input"sure";n$
1360 ifleft$(n$,1)<>"y"then1210
1370 nr=nr-1
1380 fori=crtonr:tb$(i)=tb$(i+1):forj=0tonw:tb(i,j)=tb(i+1,j):nextj,i
1390 cr=cr-1:goto1210
1400 q$="":printhm$;wh$;"<prnt>":input"from";q$:ifq$=""then1210
1410 q1$="":input"to ";q1$:ifq1$=""thenq1$=q$
1420 q$="-"+q$:m1=0:fori=1to12:ifmnth$(i)=q$thenm1=i:i=12
1430 next:m2=0:q1$="-"+q1$:fori=1to12:ifmn$(i)=q1$thenm2=i:i=12
1440 next:ifm1=0orm2=0thenea$="illegal month":goto1210
1450 open4,4:cmd4:x=79:a$="budget planner"+str$(y0)
1460 print" "a$:print:m=m0:y=y0:d=d0:q=1
1470 m2=m2+1:ifm2=13thenm2=1
1480 ifm<>m1thengosub580:q=q+1:goto1480
1490 printtab(10);:n=1
1500 a$=str$(d)+mnth$(m):gosub150:printa$;
1510 a=m:gosub580:ifa=mthenn=n+1:goto1500
1520 print:fori=0ton:print"[195][195][195][195][195][195][195][195][195][195]";:next:print
1530 fori=0tonr:a$=tb$(i):gosub150
1540 ifi=nrandmmthenprintrv$;a$;nv$;:goto1560
1550 printa$;
1560 qq=q+n-1:ifqq>52thenqq=52
1570 forj=qtoqq:x=tb(i,j):gosub120
1580 ifi=nrandx<0thenprintrv$;a$;nv$;:goto1600
1590 printa$;
1600 nextj:print:nexti
1610 print:print:q=q+n:ifq<53andm<>m2then1490
1620 m=m0:d=d0:yr=y0:w=1:cw=1:cc=1:cr=0:print#4:close4:goto1210
1630 ifd$=""thenreturn
1640 a=tb(cr,0)*val(d$):fori=cwtonw:tb(cr,i)=a:nexti:d$="":gosub210:goto350
1650 ifd$=""thenreturn
1660 a=d:b=m:c=yr:q=w:x=m
1670 ifw<>cwthengosub580:w=w+1:goto1670
1680 x=m
1690 gosub580:w=w+1:ifx=mthen1690
1700 x=m:w=w-1:gosub550:ifw>52thend=a:m=b:yr=c:w=q:d$="":goto1720
1710 tb(cr,w)=tb(cr,0)*val(d$):goto1690
1720 gosub210:goto350
1730 ifw<>cwthenw=w+1:gosub580:goto1730
1740 a=d:b=m:c=yr:w=w+1:gosub580:x=m:fl=0
1750 gosub580:w=w+1:ifx=mthen1750
1760 gosub550:w=w-1:ifw>50thenfl=-1:goto1760
1770 cc=1:cw=w:ifflthencc=3:cw=52
1780 gosub210:goto350
1790 ifw<>cwthenw=w+1:gosub580:goto1790
1800 a=d:b=m:c=yr:q=w
1810 gosub580:w=w+1:iftb(nr,w)>=0andw<>50then1810
1820 iftb(nr,w)>=0thend=a:m=b:yr=c:w=q:goto350
1830 cc=1:cw=w
1840 gosub210:goto350
1850 dimtb(18,53),tb$(18),mn$(12),mn(12)
1860 debt$=chr$(28):fg$=chr$(159):hm$=chr$(19):cl$=chr$(147):up$=chr$(145)
1870 dn$=chr$(17):lf$=chr$(157):rt$=chr$(29):cr$=chr$(13):bk$=chr$(20)
1880 rv$=chr$(18):nv$=chr$(146):wh$=chr$(5)+rv$
1890 poke53280,3:poke53281,0:printfg$
1900 rem for plus 4, prior line is color 0,4,0:color 4,4,7
1910 printfg$:fori=1to12:readmnt$(i),mnt(i):next
1920 data -jan,31,-feb,28,-mar,31,-apr,30
1930 data -may,31,-jun,30,-jul,31,-aug,31
1940 data -sep,30,-oct,31,-nov,30,-dec,31
1950 w=1:f=10:dp=-1:nw=52
1960 sp$=" "
1970 x$="":fori=1to40:x$=x$+rt$:next
1980 y$="":fori=1to24:y$=y$+dn$:next
1990 a=fre(x)
2000 nr=1:cw=1:cr=0:cc=1
2010 tb$(0)="prevbal":tb(0,0)=1
2020 tb$(1)="total"
2030 gosub2070
2040 gosub350
2050 ifd$=""then2040
2060 tb(cr,cw)=tb(cr,0)*val(d$):d$="":x=0:y=1:gosub110:printsp$:goto2040
2070 a$="budget planner":x=39:gosub160:print"[147]";fg$;a$
2080 print:printea$:f$="":ea$=""
2090 input"enter filename";f$
2100 iff$=""then2170
2110 gosub890
2120 ifeathen2070
2130 return
2140 x=y0:mnth(2)=28:ifm0>2thenx=x+1
2150 ifint(x/4)=x/4thenmn(2)=29
2160 return
2170 a$="budget planner":x=39:gosub160:print "[147]";fg$;a$
2180 printd$:input"day ";dd$:d=val(dd$)
2190 input"month ";mm$:mm$="-"+mm$
2200 input"year ";yr$:yr=val(yr$):y0=yr
2210 m=0:fori=1to12:ifmn$(i)=mm$thenm=i
2220 next: